////////////////////////////////////////////////////////////////////////////////

#ifndef _PLAYER_H_
#define _PLAYER_H_

////////////////////////////////////////////////////////////////////////////////

#include "moving_object.h"
#include "weapon.h"
#include <map>

////////////////////////////////////////////////////////////////////////////////

class Bullet;

////////////////////////////////////////////////////////////////////////////////

/** Base class for all players
*
*  @author   Roman Pasechnik
*  @since    Jun 04th, 2009
*  @updated  Jun 09th, 2009
*/
class Player : public MovingObject
{
////////////////////////////////////////////////////////////////////////////////

public:

////////////////////////////////////////////////////////////////////////////////


    /** Constructor */
    Player();


    /** Destructor */
    virtual ~Player();


////////////////////////////////////////////////////////////////////////////////


    /** Gets the amount of player hit points */
    int GetHitPoints() const;


    /** Sets the amount of player hit points */
    void SetHitPoints( int _hitPoints );


    /** Set key flags */
    void SetKeyFlags( unsigned int _flags );


    /** Gets player aim position */
    STM::Position GetAimPosition() const;


    /** Sets player aim position */
    void SetAimPosition( const STM::ScrPosition& _position );


    /** Calculate players's velocity */
    void CalculateVelocity();


    /** Process player's shooting, generates bullets */
    Bullet* ProcessShooting();


////////////////////////////////////////////////////////////////////////////////

private:

////////////////////////////////////////////////////////////////////////////////


    /** Players weapon */
    Weapon m_Weapon;


    /** Players aim */
    STM::ScrPosition m_AimPosition;


    /** Player's hit points */
    int m_HitPoints;


    /** Key flags, key bit is 1 when key pressed */
    unsigned int m_KeyFlags;


////////////////////////////////////////////////////////////////////////////////
};


/** Utility type: IDs and players */
typedef std::map<unsigned char, Player> Players;


////////////////////////////////////////////////////////////////////////////////

#endif

////////////////////////////////////////////////////////////////////////////////
